
#ifndef __AES_SYMMETRIC_KEY_H
#define __AES_SYMMETRIC_KEY_H

#include "EncryptionKey.h"
#include "DecryptionKey.h"
#include "SymmetricKey.h"

// This cheats slightly, using the base64 'key' simply as a password and expecting the hash to be good!
#define INITIALISATION_VECTOR "\x24\x3f\x6a\x88\x85\xa3\x08\xd3\x13\x19\x8a\x2e\x03\x70\x73\x44"

/** An class encapsulating a symmetric key to be used in AES encryption and
 * decryption. */
class AESSymmetricKey : public EncryptionKey, public DecryptionKey, public SymmetricKey
{
   public:
      AESSymmetricKey();
      AESSymmetricKey(const char *name);
      AESSymmetricKey(int bits, const char *name);
      AESSymmetricKey(const AESSymmetricKey &other);
      AESSymmetricKey &operator=(const AESSymmetricKey &other);
      ~AESSymmetricKey();
      int getCryptlibContext(CRYPT_CONTEXT *keycontext);
      int getCryptlibEncryptionContext(CRYPT_CONTEXT *keycontext);
      int getCryptlibDecryptionContext(CRYPT_CONTEXT *keycontext);
      int importKeyFromASCII(const char *text, const char *name);
      int exportKeyToASCII(char **text);
      int importKeyFromASCIIWithPassword(const char *text, const char *password, const char *name);
      int exportKeyToASCIIWithPassword(char **text, const char *password);
      int compareKeyEqual(SymmetricKey *symkey);
      int getKeyType();
   private:
      /** The actual key data bit string. */
      char *keypassword;
};

#endif
